#include "ScreenH.h"
#include <iostream>
using namespace std;

void gotoxy(int, int);

#define MAX_AXIS_Y 24
#define MAX_AXIS_X 79
#define MIN_AXIS_Y 0
#define MIN_AXIS_X 0


void Screen::init()
{
	resetScreenBuffer();
}

void Screen::resetScreenBuffer()
{
	for(int i=0; i<=MAX_AXIS_Y; i++)
		for(int j=0; j<=MAX_AXIS_X; j++)
			m_screenBuffer[i][j] = ' ';
}


void Screen::printScreenBuffer()
{
	gotoxy(0,0);
	
	for(int i=0; i<=MAX_AXIS_Y; i++)
		for(int j=0; j<=MAX_AXIS_X; j++)
			cout << m_screenBuffer[i][j];
	gotoxy(0,0);
}

void Screen::setToScreenBuffer(int y, int x, char c)
{
	if(x >= MIN_AXIS_X && x <= MAX_AXIS_X)
		if(y >= MIN_AXIS_Y && y <= MAX_AXIS_Y)
			m_screenBuffer[y][x] = c;	
}


const char * Screen::getScreen()const{return *m_screenBuffer;}


char Screen::getChar(int x, int y){return m_screenBuffer[y][x];};
